import pandas as pd

# 获取版本
# print(pd.__version__)
#
# # 两种数据类型
# a = [1,2,3]
# myvar = pd.Series(a,index=[1,2,3])
# print(myvar)
#
# sites = {1: "Google", 2: "Runoob", 3: "Wiki"}
# myvar = pd.Series(sites)
# print(myvar)
#
# myvar = pd.Series(sites,index=[1,2])
# print(myvar)
#
# mydataset = {
#   'sites': ["Google", "Runoob", "Wiki"],
#   'number': [1, 2, 3]
# }
#
# myvar = pd.DataFrame(mydataset)
#
# print(myvar)
# print('=======================')
# print(myvar['sites'])
# print('=======================')
# myvar = pd.Series(myvar['sites'])
# print(myvar)


# data = {
#   "calories": [420, 380, 390],
#   "duration": [50, 40, 45]
# }
#
# # 数据载入到 DataFrame 对象
# df = pd.DataFrame(data)
#
# # 返回第一行
# # print(df.loc[0])
#
# # 返回第二行
# # print(df.loc[1])
#
# # print(df.loc[[0, 1]])

data = {
  "calories": [420, 380, 390],
  "duration": [50, 40, 45]
}
df = pd.DataFrame(data,index=['day1','day2','day3'])

# 根据自定义的索引，获取行数据
print(df.loc['day1'])

# 获取多行数据
print(df.loc[['day1','day2']])